import { PaginationOptions } from '@/types/interface';
import { request } from '@/utils/request';

const url = '/api/console/dict';
const urlValue = '/api/console/dict-value';
export default {
  list: (params: PaginationOptions) => request.get({ url, params }),
  add: (data: any) => request.post({ url, data }),
  update: (data: any) => request.patch({ url, data }),
  del: (id: number) => request.delete({ url: `${url}/${id}` }),
  detail: (id: number) => request.get({ url: `${url}/${id}` }),
  display: (id: number, val: number) => request.patch({ url: `${url}/display/${id}/${val}` }),
  values: (type: string) => request.get({ url: `${url}/values/${type}` }),

  valueList: (params: any) => request.get({ url: urlValue, params }),
  valueAdd: (data: any) => request.post({ url: urlValue, data }),
  valueUpdate: (data: any) => request.patch({ url: urlValue, data }),
  valueDel: (id: number) => request.delete({ url: `${urlValue}/${id}` }),
  valueDetail: (id: number) => request.get({ url: `${urlValue}/${id}` }),
  valueDisplay: (id: number, val: number) => request.patch({ url: `${urlValue}/display/${id}/${val}` }),
  valueListorder: (data: any) => request.patch({ url: `${urlValue}/listorder/${data.id}/${data.listorder}` }),
};
